/*
 *    Copyright (c) 2018-2025, cloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cloud
 */

package com.fuyao.cloud.space.house.service;

import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuyao.cloud.common.core.util.R;
import com.fuyao.cloud.space.entity.RoomHouse;
import com.fuyao.cloud.space.vo.ExcelExportHouseVO;
import com.fuyao.cloud.space.vo.ExcelImportHouseVO;
import org.springframework.validation.BindingResult;

import java.util.List;

/**
 * 房屋信息表
 *
 * @author liyue
 * @date 2021-11-12 14:46:49
 */
public interface RoomHouseService extends IService<RoomHouse> {

	/**
	 *  根据类型加载可选项集合
	 * @param type 类型
	 * @return 可选项集合
	 */
	R getOptionList(String type);

	/**
	 * 获取导出列表
	 * @param query 查询
	 * @return 导出列表
	 */
	List<ExcelExportHouseVO> listHouse(QueryWrapper<RoomHouse> query);

	/**
	 * 查询房屋树结构
	 * @return 房屋树结构
	 */
	List<Tree<String>> selectTree();

	/**
	 * 导入房屋信息
	 * @param excelVOList 导入集合
	 * @param bindingResult 绑定返回对象
	 * @return 导入成功或导入失败信息。
	 */
	R importHouse(List<ExcelImportHouseVO> excelVOList, BindingResult bindingResult);

	/**
	 * 获取树形节点
	 * @return
	 */
	List<TreeNode<String>> getTreeNode(LambdaQueryWrapper<RoomHouse> queryWrapper);

	/**
	 * 点击树形菜单查询数据
	 * @param page        前端分页
	 * @param id          可以是自己的id，也肯能时父类的id
	 * @param affiliName  所属模块名称
	 * @return
	 */
	Page<RoomHouse> getTreePage(Page page, Long id, String affiliName);

	/**
	 * 根据父id 查询参数
	 * @param id
	 * @param affiliName
	 * @return
	 */
	List<Long> getTreeParam(Long id, String affiliName);

	/**
	 * 懒加载树
	 * @param storeyId “STOREY-id”
	 * @return
	 */
	List<Tree<String>> lazyTree(String storeyId);

	/**
	 * 懒加载树
	 * @param storeyId 楼层id
	 * @return
	 */
	List<Tree<String>> lazyTree(Long storeyId);

	/**
	 * 批量删除
	 * @param ids 房屋信息ids
	 * @return R
	 */
    R batchDelete(List<Long> ids);

	/**
	 * 查询仓库树
	 * @return
	 */
	List<Tree<String>> warehouseTree();
}
